/*
 * @Author: tangz
 * @Date: 2022-03-10 21:49:29
 * @LastEditors: tyl
 * @LastEditTime: 2022-04-28 14:34:45
 * @Description: file content
 */

module.exports = {
  lintOnSave: false,
  productionSourceMap: process.env.NODE_ENV !== 'production', // 生产环境不生成sourcemap文件
  filenameHashing: true,
  configureWebpack: (config) => {
    // 取消console打印
    config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true;
    if (process.env.NODE_ENV === "production") {
      return {
        externals: {
          vue: "Vue",
          "element-ui": {
            commonjs: "element-ui",
            commonjs2: "element-ui",
            root: "ELEMENT",
          },
        },
        devtool: process.env.NODE_ENV !== 'production' ? 'source-map' : ''
      };
    }
  },
  devServer: {
    proxy: {
      "/yaoud_workorder_forward": {
        target: "http://172.19.1.222:8000/workorder",
        changeOrigin: true,
        pathRewrite: {
            '^/yaoud_workorder_forward': ''
        }
      }
    }
  }
};
